home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Magnum One
/
Magnum One (Mid-American Digital) (Disc Manufacturing).iso
/
d12
/
v7n17.arc
/
MESSAGE.BAS
< prev
next >
Wrap
BASIC Source File
|
1988-09-13
|
2KB
|
67 lines
DEFINT A-Z
SCREEN 2
'set up message and window location
MESSAGE$ = ".........The quick brown fox jumped over the lazy dog"
LEFT = 220
RIGHT = 420
TOP = 8
LETNUM = 0
COLUMN = 8
LINE (LEFT - 2, TOP - 2)-(RIGHT + 2, TOP + 9), 1, B 'draw box around window
DIM BUFF(2 + INT((RIGHT - LEFT + 7) / 8) * 4) 'space for buffer
DEF SEG = &HF000 'segment of ROM characters
' To get a smooth crawl, we must use timed interrupts. However,
' ON TIMER has a minimum interval of 1 second, which is not fast enough.
' We are forced to use ON PLAY with a song consisting of a single rest.
PLAY "MB T130 L32 N0" 'set up "song"
ON PLAY(1) GOSUB MOVEIT 'set up timed interrupt
PLAY ON 'enable timed interrupt
' A foreground task can be executing here. In this case, the time
' of day is printed on the screen.
WHILE INKEY$ = ""
LOCATE 5, 37
PRINT TIME$
WEND
END
' Interrupt handler for ON PLAY
'
' MOVEIT receives control at regular intervals through the ON PLAY
' statement. It takes the current image in the window and shifts it
' right one column. It then adds a new column at the left hand edge.
' This creates a message that "crawls" from left to right.
MOVEIT:
GET (LEFT, TOP)-(RIGHT - 1, TOP + 7), BUFF 'get current image
PUT (LEFT + 1, TOP), BUFF, PSET 'shift image to right
' A new column is added at the left. This is constructed using the
' character pattern table located in ROM at F000:FA6E
COLUMN = COLUMN + 1
IF COLUMN = 9 THEN
COLUMN = 1
LETNUM = LETNUM + 1 'start a new letter
IF LETNUM > LEN(MESSAGE$) THEN LETNUM = 1 'wrap around if necessary
'compute offset into pattern table for the new letter
OFFSET = &HFA6E + ASC(MID$(MESSAGE$, LEN(MESSAGE$) - LETNUM + 1, 1)) * 8
END IF
'copy one column of the pattern into the left edge of the window
FOR ROW = 0 TO 7
BYTE = OFFSET + ROW
BIT = (PEEK(BYTE) AND 2 ^ (COLUMN - 1))
IF BIT = 0 THEN PRESET (LEFT, TOP + ROW) ELSE PSET (LEFT, TOP + ROW)
NEXT
PLAY "MB N0" 'create a new "song"
RETURN